var aUi = aUi || {};
aUi.onShelfInven = {

	_addreceipt: function(data) {
		var html = '<li class="mui-table-view-cell">' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p class="cell-time">' + data.stateName + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p>x' + data.qty + '</p>' +
			'<p>' + data.createtime + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'</li>';
		return html;
	},

	_detail: function(data) {

		var html = '<li class="mui-table-view-cell">' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p class="cell-time">' + data.createtime + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p>x' + data.qty + '</p>' +
			'<p>' + data.creator + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'</li>';
		return html;
	},

	//拣货详情列表
	_addReceiptDetail: function(data) {
		var putawayQty = 0;
		var color = "#FC5959";
		var state = "未完成";

		if (data.putawayQty != null) {
			putawayQty = data.putawayQty;
		}

		var remainAmount = parseInt(data.qty) - parseInt(putawayQty);
		var inStatus = data.inStatus;

		if (remainAmount == 0) {
			state = "已完成";
			color = "#0091FF"
		} else if (remainAmount < 0) {
			state = "已超出";
		}

		var html = '<li  data-dateInProduced="' + data.date_in_produced + '"  data-putawayQty="' + data.putawayQty + '" data-periodOfValidity="' + data.period_of_validity + '" data-unitPrice="' + data
			.unit_price + '" data-specification="' + data.specification + '" data-batchNumber="' + data
			.batch_number + '" data-inStatus="' + data.inStatus + '" data-qty="' + data.qty + '" data-id="' +
			data.id + '" data-commoditybar="' + data.commoditybar +
			'" data-commodityname="' + data.commodityname +
			'" class="mui-table-view-cell mui-media item-cell" style="display:;">' +
			'<div class="content-top">' +
			'<div class="top-title">商品编码：' + data.commoditybar + '</div>' +
			'</div>' +
			'<div class="top-line"></div>' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../images/comman/icon_location.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p  style="color:' + color + '">' + state + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p >已上数量：' + putawayQty + '</p>' +
			'<p >总数量：' + data.qty + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'<div class="top-line2"></div>' +
			'<div class="bottom-content">' +
			'<div class="user">' +
			'<div class="avarimage">' +
			'<img class="" src="../../../../images/comman/icon_company.png">' +
			'</div>' +
			'<div class="name">' + data.manufacturer + '</div>' +
			'</div>' +
			'</div>' +
			'</li>';
		return html;
	},
	
	_addrecordList: function(data) {
		var html = '<li data-id="'+data.id +'" class="mui-table-view-cell mui-media item-cell" style="display:;">'+
			'<div class="content-top">'+
				'<div class="top-title">商品编码：'+data.commoditybar+'</div>'+
			'</div>'+
			'<div class="top-line"></div>'+
			'<div class="content-mid">'+
				'<div class="left-image">'+
					'<img class="" src="../../../../images/comman/icon_materials.png">'+
				'</div>'+
				'<div class="mid-text">'+
					'<div class="left-text">'+
						'<p class="cell-title">'+data.commodityname+'</p>'+
						'<p class="cell-time">'+data.manufacturer+'</p>'+
					'</div>'+
					'<div class="right-text">'+
						'<p >'+data.stateName+'</p>'+
						'<p ></p>'+
					'</div>'+
				'</div>'+
			'</div>'+
			'<div class="top-line2"></div>'+
			'<div class="bottom-content">'+
				'<div class="user">'+
					'<div class="avarimage">'+
						'<img class="" src="../../../../images/comman/icon_location.png">'+
					'</div>'+
					'<div class="name">'+data.locatorcode+'</div>'+
				'</div>'+
				'<div class="time">'+data.createtime+'</div>'+
			'</div>'+
		'</li>';
		return html;
	},

	receipt: function(list) {
		var html = "";
		for (var i = 0; i < list.length; i++) {
			var data = list[i];
			html += this._addreceipt(data);
		}
		return html;
	},


	purchaseDetails: function(list) {
		var html = "";
		for (var i = 0; i < list.length; i++) {
			var data = list[i];
			html += this._addReceiptDetail(data);
		}
		return html;
	},
	
	recordListLevel: function(list) {
		var html = "";
		for (var i = 0; i < list.length; i++) {
			var data = list[i];
			html += this._addrecordList(data);
		}
		return html;
	},

};
